<?php

class Redactor extends __Controller {
	function __construct() {
		parent::__construct();

		$this->load->module('files', $this->files);
		$this->load->model('admin/member', $this->member);

		$m = $this->member->getMember();

		$this->level = $m['level'];

		if ($this->level != 0) exit;

	}

	function image() {
		setHeader("json");
		
		if ($this->files-> upload() ) {

			$url = $this->files->getUrl();

			$array = array(
				'filelink' => $url['file'][0],
			);

			echo json_encode($array);
			
		}
					

	}
	function file() {
		setHeader("json");

		if ($this->files -> upload() ) {

			$url = $this->files->getUrl();
			$data = $this->files->getData();
					
			$array = array(
				'filelink' => $url['file'][0],
				'filename' => $data['file'][0]
			);
			
			echo stripslashes(json_encode($array));
		}	
		
	}
	function save() {
		
		
	}
	function test() {
?>
<!DOCTYPE HTML>
<!--//
This web page has been developed by Wani.
 - wan2land@gmail.com
 - http://wani.kr
-->
<html lang="ko">
<head>
<title></title>

<meta charset="UTF-8" />


<!--[if lt IE 9]>
<script src="<?php echo $library ?>/js/html5shiv.js"></script>
<![endif]-->

</head>
<body>

<form action="http://localhost/wanikr/redactor/image" method="post" enctype="multipart/form-data">
	<input type="file" name="file" />
	<input type="submit" />	
</form>

</body>
</html>

<?php
		
	}
}